<?php
error_reporting("E_ALL");ini_set("display_errors", 1);
$getdata=$_REQUEST;
if(empty($getdata))$getdata=$_POST?$_POST:$_GET;
$type=empty($getdata['type'])?'':$getdata['type'];
include("include/function.php");
//header("content-Type: application/json; charset=utf-8");
$config = include("config.php");
include("include/".$config['DB_TYPE'].".class.php");
$db = new db;
$db->connect($config['DB_HOST'],$config['DB_USER'],$config['DB_PWD'],$config['DB_NAME'], $config['DB_PCONNECT']);
      
$page = empty($getdata['page'])?1:$getdata['page'];
$id = empty($getdata['id'])?0:$getdata['id'];
$length=200000;
$where="编号!=''";
$orderids=[];
$insert=0;
$sql="select * from sheet1 where ".$where.' limit '.$length;
$list = $db->get_all($sql);if(empty($list))exit('over');
$ssql=[];$noschool=[];$nomch=[];
foreach($list as $v){if(empty($v['编号']))continue;
    
    
        $data=[];
        $data['food_num']=$v['应用餐天数'];
        $data['cancel_day']=$v['请假天数'];
        $data['real_food_day']=$v['实际用餐天数'];
        $data['money']=$v['缴费金额'];
        $data['food_fee']=$v['用餐金额'];
        $data['refund_fee']=$v['退餐费金额'];
        $data['new_refund_fee']=$v['对账退费金额'];
        $data['old_refund_fee']=$v['应退金额'];
        $sdata=[];
        foreach($data as $k1=>$v1){
            $sdata[]="`".$k1."`='".$v1."'";
        }
        $ssql[] = "update hema_food_order_verify set ".implode(',',$sdata)." where verify_id='".$v['编号']."';";
        
}
echo count($ssql)."<br>\n";
echo implode("\n",$ssql);
//$log = $id.'导入成功,处理：'.$insert.'条';
//echo $log.'<script>location.href="?page='.$page.'&id='.$id.'";</script>';

//echo count($sqlarr)."\n";
//echo implode(";\n",$sqlarr);
?>